<?php
/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/9/21 16:20
 * Desc: 注册
 */
class Request_Api_V2_Member_Register extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);
    }

    public function do_reg()
    {
        $this->rules = [
            ['user', ['not_empty']],
            ['pwd', ['not_empty', $this->rule_min_length(6)]],
            ['msg_code', ['not_empty']],
            ['captcha_key', ['not_empty']],
            ['code', ['not_empty']]
        ];

        if (isset($this->request_param['user'])) {
            $user_type = strpos($this->request_param['user'], '@') !== false ? 'email' : 'phone';
            $this->validation->rule('user', $user_type);
        }

        return $this;
    }


}